package hyl.base.net.iot;

import java.io.Serializable;

import hyl.core.data.BlockValue;
import hyl.core.net.IReader;
/**
 * C类节点在上级服务器的缓冲区信息
 * @author 37798955@qq.com
 *
 */
public class InfoValue<T> implements Serializable {
	/**
	 * 版本号
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * 身份标识
	 */
	String cname;
	int id2;
	/**
	 * 微服务器bid
	 */
	int id1;
	/**
	 * 接收器
	 */
	IReader reader;

	public Netpg3 netpg3;
	/**
	 * 应答
	 */
	BlockValue<T> reply ;
	//static BlockValue<?> replyroot;
	public InfoValue() {
	}

	public InfoValue(String cname, int bid, IReader reader) {
		//if (replyroot==null)
		//	replyroot=new BlockValue<T>(3000);
		//reply=( BlockValue<T>)replyroot.clone();
		this.reply=new BlockValue<T>(3000);
		this.cname = cname;
		this.id2 = 	PFun.dname2Int(cname);
		this.id1 = bid;
		this.reader = reader;
	}

	public int getCid() {
		return id2;
	}

	public void setCid(int cid) {
		this.id2 = cid;
	}

	public int getBid() {
		return id1;
	}

	public void setBid(int bid) {
		this.id1 = bid;
	}

	public String getCname() {
		return cname;
	}

	public void setCname(String cname) {
		this.cname = cname;
	}

	public T getReply() {
		return reply.get();
	}
	/**
	 * true 表示 数据是从A发送到B ,然后B应答的结果
	 * 
	 * false 表示 数据时从B直接上传到A 
	 * 
	 * @return
	 */
	public boolean hasReply() {
		return reply.isBlock();
	}
	
	public void setReply(T 答复) {
		this.reply.set(答复);
	}


}
